package com.acwing.partition15;

import java.io.*;
import java.util.Arrays;

/**
 * @author `RKC`
 * @date 2022/2/14 20:11
 */
public class AC1443拍照 {

    private static final int N = 1010;
    private static int[] a = new int[N], b = new int[N];
    private static boolean[] st = new boolean[N];

    private static int n = 0;

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        n = Integer.parseInt(reader.readLine());
        String[] ss = reader.readLine().split(" ");
        for (int i = 1; i < n; i++) b[i] = Integer.parseInt(ss[i - 1]);
        for (int i = 1; i <= n; i++) {
            if (check(i)) break;
        }
        for (int i = 1; i <= n; i++) writer.write(a[i] + " ");
        writer.flush();
    }

    private static boolean check(int a1) {
        Arrays.fill(st, false);
        a[1] = a1;
        st[a1] = true;
        for (int i = 2; i <= n; i++) {
            a[i] = b[i - 1] - a[i - 1];
            if (a[i] < 1 || a[i] > n || st[a[i]]) return false;
            st[a[i]] = true;
        }
        return true;
    }
}
